# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=poly
pkgver=52.4e6f189
pkgrel=4
pkgdesc='Polymorphic webshells.'
arch=('any')
groups=('blackarch' 'blackarch-webapp' 'blackarch-backdoor')
url='https://github.com/grCod/poly'
license=('MIT')
depends=('python2' 'python2-argparse')
makedepends=('git')
source=("git+https://github.com/grCod/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 644 -t "$pkgdir/usr/share/$pkgname" README.md
  install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE

  rm LICENSE README.md

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname-webshells" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname-webshells"
}

